package com.sgcc.ln.pmos.common.utils;

import android.content.Context;

import androidx.annotation.NonNull;

import com.bumptech.glide.Glide;
import com.bumptech.glide.GlideBuilder;
import com.bumptech.glide.Registry;
import com.bumptech.glide.annotation.GlideModule;
import com.bumptech.glide.load.model.GlideUrl;
import com.bumptech.glide.module.AppGlideModule;
import com.bumptech.glide.module.LibraryGlideModule;
import com.zhy.http.okhttp.OkHttpUtils;

import java.io.InputStream;

import okhttp3.OkHttpClient;


@GlideModule
public final class OkhttpGlideModule extends AppGlideModule {

    @Override
    public void registerComponents(@NonNull Context context, @NonNull Glide glide, @NonNull Registry registry) {
        super.registerComponents(context, glide, registry);
        registry.replace(GlideUrl.class, InputStream.class,
                new OkHttpUrlLoader.Factory(OkHttpUtils.getInstance().getOkHttpClient()));
//        new OkHttpUrlLoader.Factory(new OkHttpClient()));
    }
}
